package com.k7.mobile.platform.bo.impl;

import java.util.List;

import com.k7.mobile.platform.bo.IBanIpBO;
import com.k7.mobile.platform.dao.IBanIpDAO;
import com.k7.mobile.platform.dataobject.BanIpDO;
import com.k7.mobile.platform.exception.BOException;

public class BanIpBOImpl extends BaseBOImpl implements IBanIpBO{
	
	private IBanIpDAO banIpDAO;

	public void setBanIpDAO(IBanIpDAO banIpDAO) {
		this.banIpDAO = banIpDAO;
	}

	public Long add(BanIpDO banIpDO) throws BOException {
		try{ 
			Long id=banIpDAO.add(banIpDO);
			return id;
		}catch(Exception ex){
			log.error("BanIpBOImpl:add,插入IP失败", ex);
			throw new BOException("创建禁止IP失败", ex);
		}
	}

	@Override
	public void delete(BanIpDO banIpDO) throws BOException {
		try{
			banIpDAO.delete(banIpDO);
		}catch(Exception ex){
			log.error("BanIpBOImpl:delete,删除IP失败", ex);
			throw new BOException("删除IP失败", ex);
		}
		
	}

	@Override
	public List<BanIpDO> findList(BanIpDO banIpDO) throws BOException {
		try{
			List<BanIpDO> list = banIpDAO.findList(banIpDO);
			return list;
		}catch(Exception ex){
			log.error("BanIpBOImpl:findBarDO,批量获取IP信息出错", ex);
			throw new BOException("批量获取IP信息出错", ex);
		}
		
	}

	@Override
	public BanIpDO getBanIp(BanIpDO banIpDO) throws BOException {
		try{

			BanIpDO returnDO = banIpDAO.getBanIp(banIpDO);

			return returnDO;
		}catch(Exception ex){
			log.error("BanIpBOImpl:getBanIp,获取IP信息出错", ex);
			throw new BOException("获取IP信息出错", ex);
		}
	}
}
